;
;
;I took this code from David O'Toole's web page: http://orgmode.org/worg/org-configs/org-config-examples.php#sec-2.2
;
;

(add-hook 'org-mode-hook (lambda ()
                           (local-set-key "\M-n" 'outline-next-visible-heading)
                           (local-set-key "\M-p" 'outline-previous-visible-heading)
                           ;; table
                           (local-set-key "\M-\C-w" 'org-table-copy-region)
                           (local-set-key "\M-\C-y" 'org-table-paste-rectangle)
                           (local-set-key "\M-\C-l" 'org-table-sort-lines)
                           ;; display images
                           (local-set-key "\M-I" 'org-toggle-iimage-in-org)
                           ;; fix tab
                           (local-set-key "\C-y" 'yank)
                           ;; yasnippet (allow yasnippet to do it's thing in org files)
                           (make-variable-buffer-local 'yas/trigger-key)
                           (setq yas/trigger-key [tab])
                           (define-key yas/keymap [tab] 'yas/next-field-group)))

;iimage in org (display images in org files)

;Thanks to many on the mailing list for this great addition to Org-Mode. See ;iimage (http://www.netlaputa.ne.jp/~kose/Emacs/iimage.html) for information ;on iimage-minor-mode. 


(add-to-list 'iimage-mode-image-regex-alist
             (cons (concat "\\[\\[file:\\(~?" iimage-mode-image-filename-regex
                           "\\)\\]")  1))

(defun org-toggle-iimage-in-org ()
  "display images in your org file"
  (interactive)
  (if (face-underline-p 'org-link)
      (set-face-underline-p 'org-link nil)
      (set-face-underline-p 'org-link t))
  (iimage-mode))
